users2 = {
    'admin': {
        'username': 'admin',
        'password': '123456',
        'status': 'true'
    },
    'admin2': {
        'username': 'admin2',
        'password': '123456',
        'status': 'false'
    }
}

# 登录次数限制
max_attempts = 3
attempts = 0

while attempts < max_attempts:
    user = input("请输入用户名：")
    password = input("请输入密码：")
    
    # 检查用户名是否存在
    if user not in users2:
        print("用户名不存在")
        attempts += 1
        continue
    
    # 检查用户状态
    if users2[user]['status'] == 'false':
        print("用户被禁用")
        attempts += 1
        continue
    
    # 检查密码
    if users2[user]['password'] == password:
        print("登录成功")
        break
    else:
        print("密码错误")
        attempts += 1

# 如果三次机会用完
if attempts >= max_attempts:
    print("次数用尽")